﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
using System.Xml;

namespace FMAPortalBase.Model
{
    [Serializable]
    public class MenuItem
    {
        public String Title { get; set; }
        public UserGroup userGroup { get; set; }
        public String Id { get; set; }
        //public Authentication authentication{get;set;}

        protected String Serialize()
        {
            return this.ToJson();
        }
        protected void DeSerialize(StringBuilder json)
        {
            MenuItem mnItem = json.DeSerialize<MenuItem>();
            this.Id = mnItem.Id;
            this.Title = mnItem.Title;
            this.userGroup = mnItem.userGroup;
        }

    }
    [Serializable]
    public class Menu:MenuItem
    {
        public List<MenuItem> Children { get; set; }

        public Menu() { }
        public Menu(StringBuilder json)
        {
            this.DeSerialize(json);
        }

        public String ToJson
        {
            get
            {
                return this.Serialize();
            }
        }
    }
}
